Skip to content

Add timezone selector to quiet hours in web UI - #35

Open
jampick wants to merge 1 commit into
mainfrom
claude/agitated-satoshi
Open

Add timezone selector to quiet hours in web UI#35
jampick wants to merge 1 commit into
mainfrom
claude/agitated-satoshi

Conversation

@jampick

@jampick jampick commented Mar 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • The quiet hours section in the web UI previously showed the Pi's system timezone as read-only info text, with no way to change it
  • Users can now pick any IANA timezone from a dropdown (e.g. America/New_York, Europe/London, Asia/Tokyo) so quiet hours work correctly regardless of what timezone the Pi is set to
  • Falls back to system local time when left at "System default"

Changes

  • pi/appliance.py — add quiet_tz key to default config ("" = system timezone)
  • pi/webapp/server.py — add SELECTABLE_TIMEZONES list with ~40 common IANA zones; validate submitted quiet_tz; pass timezone list to template
  • pi/webapp/templates/index.html — replace static timezone label with a <select> dropdown populated from the server
  • printpulse/watch.py_is_in_quiet_hours() accepts optional tz (IANA string) and uses zoneinfo.ZoneInfo; run_watch_loop() accepts quiet_tz
  • printpulse/app.py — add --quiet-tz CLI arg
  • printpulse/pi_launcher.py — pass --quiet-tz to watch loop when set in config
  • tests/test_watch.py — add TestIsInQuietHoursWithTimezone covering explicit TZ and invalid TZ fallback

Test plan

  • Run python -m pytest tests/ -v -s — all tests pass
  • On the Pi: open web UI, enable quiet hours, confirm timezone dropdown appears with "System default" pre-selected
  • Select a different timezone (e.g. America/New_York), save — confirm the watcher log shows the chosen TZ in the quiet hours label
  • Leave timezone at "System default" — confirm existing behaviour is unchanged

🤖 Generated with Claude Code

Users can now pick an IANA timezone (e.g. America/New_York) for quiet
hours from a dropdown in the web UI rather than always using the Pi's
system timezone. Quiet hours check in watch.py respects the configured
timezone via zoneinfo; falls back to system local time when unset.

- pi/appliance.py: add quiet_tz default ("" = system timezone)
- pi/webapp/server.py: SELECTABLE_TIMEZONES list, validate quiet_tz,
  pass timezones to template
- pi/webapp/templates/index.html: replace static timezone label with
  a <select> dropdown
- printpulse/watch.py: _is_in_quiet_hours accepts optional tz param;
  run_watch_loop accepts quiet_tz
- printpulse/app.py: add --quiet-tz CLI arg
- printpulse/pi_launcher.py: pass --quiet-tz when set in config
- tests/test_watch.py: add TestIsInQuietHoursWithTimezone

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant